<?php echo $header; ?>
<div id="content">
    <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
    </div>
    <?php if ($error_warning) { ?>
    <div class="warning"><?php echo $error_warning; ?></div>
    <?php } ?>
    <div class="box">
    <div class="heading">
        <h1><img src="view/image/module.png" alt="" /> <?php echo $heading_title; ?></h1>
        <div class="buttons"><a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a><a href="<?php echo $cancel; ?>" class="button"><?php echo $button_cancel; ?></a></div>
    </div>
    <div class="content">
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="form">
          <tbody><tr>
            <td><span class="required">*</span><?php echo $entry_key; ?></td>
            <td><input name="express_track_key" value="<?php echo $express_track_key; ?>" size="40">
              </td>
          </tr>
        </tbody></table>
        <table id="module" class="list">
          <thead>
            <tr>
              <td class="left"><?php echo $entry_code; ?></td>
              <td class="left"><?php echo $entry_name; ?></td>
              <td class="left"><?php echo $entry_status; ?></td>
              <td class="right"><?php echo $entry_sort_order; ?></td>
              <td></td>
            </tr>
          </thead>
          <?php $module_row = 0; ?>
          <?php foreach ($modules as $module) { ?>
          <tbody id="module-row<?php echo $module_row; ?>">
            <tr>
              <td class="left">
              <input type="text" name="express_track_data[<?php echo $module_row; ?>][code]" value="<?php echo $module['code']; ?>" size="10">
              </td>
              <td class="left">
              <input type="text" name="express_track_data[<?php echo $module_row; ?>][name]" value="<?php echo $module['name']; ?>" size="30">
              </td>
              <td class="left">
              <select name="express_track_data[<?php echo $module_row; ?>][status]">
                     <?php if ($module['status']) { ?>
                  <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                  <option value="0"><?php echo $text_disabled; ?></option>
                  <?php } else { ?>
                  <option value="1"><?php echo $text_enabled; ?></option>
                  <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                  <?php } ?>
              </select>
              </td>
              <td class="right"><input type="text" name="express_track_data[<?php echo $module_row; ?>][sort_order]" value="<?php echo $module['sort_order']; ?>" size="3" /></td>
              <td class="left"><a onclick="$('#module-row<?php echo $module_row; ?>').remove();" class="button"><?php echo $button_remove; ?></a></td>
            </tr>
          </tbody>
          <?php $module_row++; ?>
          <?php } ?>
          <tfoot>
            <tr>
              <td colspan="4"></td>
              <td class="left"><a onclick="addModule();" class="button">新增</a></td>
            </tr>
          </tfoot>
        </table>
      </form>

      
      <!-- 支持的信息 -->
      <div class="support">
        <h3>帮助信息</h3>
        <ol style="line-height:20px;">
        	<li><b>使用本插件前，请先安装VQMOD</b></li>
            <li><b>使用本插件前，需要先向快递100申请API的授权KEY，申请地址：</b>
    <a target="_blank" href="http://www.kuaidi100.com/app/reg.html">http://www.kuaidi100.com/app/reg.html </a></li>
            <li><b>本插件支持多家快递公司，详细的公司名单请查看：</b> <a target="_blank" href="http://code.google.com/p/kuaidi-api/wiki/Open_API_API_URL">http://code.google.com/p/kuaidi-api/wiki/Open_API_API_URL</a></li>
            <li><b>本插件在安装的时候会自动初始化快递公司和代码信息,如不需要请移出,或者设置常用的快递公司.</b></li>
            <li><b>如果您法完成本插件的安装和使用,请联系  QQ:30171310(验证信息:opencart插件)  或者发邮件到  30171310@qq.com  获取帮助</b></li>
        </ol>
    </div>
    <!-- 支持的信息 -->
    </div>
  </div>
</div>
<script type="text/javascript"><!--
var module_row = <?php echo $module_row; ?>;

function addModule() {	
	html  = '<tbody id="module-row' + module_row + '">';
	html += '  <tr>';
	html += '    <td class="left"><input type="text" name="express_track_data[' + module_row + '][code]" value="" size="10" /></td>';
	html += '    <td class="left"><input type="text" name="express_track_data[' + module_row + '][name]" value="" size="30" /></td>';
	html += '    <td class="left"><select name="express_track_data[' + module_row + '][status]">';
    html += '      <option value="1" selected="selected">可用</option>';
    html += '      <option value="0">不可用</option>';
    html += '    </select></td>';
	html += '    <td class="right"><input type="text" name="express_track_data[' + module_row + '][sort_order]" value="" size="3" /></td>';
	html += '    <td class="left"><a onclick="$(\'#module-row' + module_row + '\').remove();" class="button">移出</a></td>';
	html += '  </tr>';
	html += '</tbody>';
	
	$('#module tfoot').before(html);
	
	module_row++;
}
//--></script>
<?php echo $footer; ?>